package a02;

public class ConnectFourPlayer implements ki.FourKI {

    private Vier v = new Vier();

    public AlphaBetaGame<Byte> ai = new AlphaBetaGame<Byte>() {
	@Override
	public int getDepth() {
	    if (ConnectFourPlayer.this.v.getMovesDone() < 6) {
		return 8;
	    }
	    if (ConnectFourPlayer.this.v.getMovesDone() < 8) {
		return 9;
	    }
	    if (ConnectFourPlayer.this.v.getMovesDone() < 10) {
		return 10;
	    }
	    if (ConnectFourPlayer.this.v.getMovesDone() < 14) {
		return 11;
	    }
	    if (ConnectFourPlayer.this.v.getMovesDone() < 16) {
		return 12;
	    }
	    if (ConnectFourPlayer.this.v.getMovesDone() < 18) {
		return 14;
	    }
	    return 30;
	}
    };

    @Override
    public int nextMove() {
	byte result = this.ai.bestMove(this.v);
	this.v = this.v.doMove(result);
	return result;
    }

    @Override
    public void nextMove(int i) {
	this.v = this.v.doMove((byte) i);
    }
}
